package cn.stylefeng.guns.core.schedue.spring;
import cn.stylefeng.guns.modular.yingbao.entity.SysBuilding;
import cn.stylefeng.guns.modular.yingbao.handler.BuildingHandler;
import cn.stylefeng.guns.modular.yingbao.handler.SysSellHandler;
import cn.stylefeng.guns.modular.yingbao.service.*;
import cn.stylefeng.guns.modular.yingbao.service.impl.SysSellServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.PostMapping;

/**
 * @author jj
 * @date 2020/1/13 9:44
 */

public class Timer {
    @Autowired
    UserMoneyService userMoneyService;

    @Autowired
    SysUserMessageService sysUserMessageService;

    @Autowired
    UserMoneyLogService userMoneyLogService;

    @Autowired
    SysRebateService sysRebateService;

    @Autowired
    SysSellLogService sysSellLogService;

    @Autowired
    SysBuildingService sysBuildingService;

    @Autowired
    UserMyService userMyService;

    @Autowired
    SysSellServiceImpl sysSellServiceImpl;


    @Scheduled(cron = "0 0 1 1/1 * ?")
    public void update() {
        System.out.println("开始执行定时1");
        userMoneyService.updateDay();
    }

    @Scheduled(cron = "0 0 2 1/1 * ?")
    public void deleteMessage() {
        System.out.println("开始执行定时2");
        sysUserMessageService.deleteDate();
    }

    @Scheduled(cron = "0 0 3 1/1 * ?")
    public void deleteUserMoneyLog() {
        System.out.println("开始执行定时3");
        userMoneyLogService.deleteUserMoneyLog();
    }
    @Scheduled(cron = "0 0 4 1/1 * ?")
    public void deleteSysRebate() {
        System.out.println("开始执行定时4");
        sysRebateService.deleteSysRebate();
    }

    @Scheduled(cron = "0 0 5 1/1 * ?")
    public void deleteSysSell() {
        System.out.println("开始执行定时5");
        sysSellLogService.deleteSysSell();
    }

    @Scheduled(cron = "0 1/5 * * * ?")
    public void updateBuilding() {
        System.out.println("开始执行定时6");
        sysBuildingService.updateBuilding();
    }

    @Scheduled(cron = "0 0 0 1/1 * ?")
    public void VIPDate(){
        userMyService.VIPData();
    }

    //超时订单
    @Scheduled(cron = "3 0/20 * * * ?")
    public void upSell(){
        sysSellServiceImpl.upSell();
    }


    //订单支付倒计时
    @Scheduled(cron = "6 0/20 * * * ?")
    public void upIndent(){
        sysSellServiceImpl.upIndent();
    }
}
